home *** CD-ROM | disk | FTP | other *** search
- #include <exec/exec.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include "work:romconf/doorheader.h"
- #include <proto/exec.h>
- #include <string.h>
- #include "source:aztec/glue.h"
-
- void creds(void);
- char cmd[200];
- char mypath[200];
- char tempname[400];
- char filename[200];
- char showname[200];
- int mynode;
- int Edited=0;
- void end(void);
- void LastCommand(void);
- #define sm sendmessage
- #define gu getuserstring
-
- main(int argc,char *argv[])
- {
- register int i;
- if(argc!=2)
- {
- printf(".-----------------------------------------------------.\n",1);
- printf("| Ami-Express Diary Version 1.0 Written by ByteMaster |\n");
- printf("| /X Development Team - The Silent Achievers |\n");
- printf("`-----------------------------------------------------'\n");
- printf("\n");
- printf(" This is a (XIM) for AmiExpress 2.30+\n");
- printf("\n");
- exit(0);
- }
- Register(argv[1][0]-'0');
- creds();
-
- mynode=argv[1][0]-'0';
- gu(cmd,BB_MAINLINE);
- gu(filename,BB_LOCAL);
- sprintf(tempname,"%sNode%d/PlayPen/%s",filename,mynode,cmd);
- strcpy(mypath,argv[0]);
- i=strlen(mypath)-1;
- while(mypath[i]!='/' && mypath[i]!=':') i--;
- mypath[i+1]='\0';
-
- sprintf(filename,"%s%s.dat",mypath,cmd);
- sprintf(showname,"%s%s",mypath,cmd);
- showgfile(showname);
- Edited=1;
- Editfile(tempname,0);
- ShutDown();
- end();
- }
- void end(void)
- {
- exit(0);
- }
- void LastCommand(void)
- {
- FILE *fi,*fo;
- char name[200];
- char date[200];
- char oldname[200];
- char oldplayname[200];
- if(Edited)
- {
- gu(name,DT_NAME);
- strcpy(date,GetTheDate(NULL));
- sprintf(oldname,"%s.old",filename);
- sprintf(oldplayname,"%s.old",tempname);
-
- fi=fopen(tempname,"r");
- if(fi!=NULL)
- {
- Rename(filename,oldname);
-
- fo=fopen(oldplayname,"a");
- if(fo==NULL)
- {
- sm("Error! can't save file",1);
- }
- else
- {
- fprintf(fo,"\n");
- fprintf(fo,"-------------------------------------------------------------------------\n");
- fprintf(fo,"[%s] %s\n",date,name);
- fprintf(fo,"\n");
- while(fgets(date,80,fi)!=NULL)
- fprintf(fo,"%s",date);
- fclose(fo);
- }
- fclose(fi);
- DeleteFile(tempname);
- sprintf(tempname,"Join >nil: %s %s to %s",oldplayname,oldname,filename);
- Execute(tempname,NULL,NULL);
- DeleteFile(oldplayname);
- DeleteFile(oldname);
- }
-
- }
- sm("",1); sm("",1);
- }
-
- void creds(void)
- {
- sm(" .--------------------------------------------------------------------------.",1);
- sm(" | Ami-Express Diary Version 1.0 Written by ByteMaster |",1);
- sm(" | /X Development Team - The Silent Achievers |",1);
- sm(" `--------------------------------------------------------------------------'",1);
- sm("",1);
- }